package com.meituan.verintreport.task;

import lombok.Data;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

@Data
public abstract class BaseTableTask extends QuartzJobBean {

    private boolean enable = true;
    private boolean enableTx = false;

    public boolean isEnable() {
        return enable || enableTx;
    }

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        enableTx = true;
        this.execute();
    }

    public abstract void execute();
}
